/*    */ package handling.login.handler;
/*    */ 
/*    */ import client.MapleClient;
/*    */ import constants.JobConstants;
/*    */ import constants.ServerConstants;
/*    */ import handling.channel.ChannelServer;
/*    */ import handling.login.LoginServer;
/*    */ import tools.MaplePacketCreator;
/*    */ import tools.data.input.LittleEndianAccessor;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CharSelectedHandler
/*    */ {
/*    */   private static boolean loginFailCount(MapleClient c) {
/* 21 */     c.loginAttempt = (short)(c.loginAttempt + 1);
/* 22 */     return (c.loginAttempt > 5);
/*    */   }
/*    */   
/*    */   public static void handlePacket(LittleEndianAccessor slea, MapleClient c) {
/* 26 */     int charId = slea.readInt();
/* 27 */     if (!c.isLoggedIn() || loginFailCount(c) || !c.login_Auth(charId)) {
/* 28 */       c.announce(MaplePacketCreator.enableActions());
/*    */       return;
/*    */     } 
/* 31 */     if (ChannelServer.getInstance(c.getChannel()) == null || c.getWorld() != 0) {
/* 32 */       c.getSession().close();
/*    */       return;
/*    */     } 
/* 35 */     int job = c.getCharacterJob(charId);
/* 36 */     if (job > -1 && 
/* 37 */       !ServerConstants.isOpenJob(JobConstants.getJobGroupName(job))) {
/* 38 */       c.dropMessage("该职业暂未开放,敬请期待!");
/* 39 */       c.announce(MaplePacketCreator.enableActions());
/*    */       
/*    */       return;
/*    */     } 
/* 43 */     if (c.getIdleTask() != null) {
/* 44 */       c.getIdleTask().cancel(true);
/*    */     }
/*    */     
/* 47 */     String ip = c.getSessionIPAddress();
/* 48 */     LoginServer.putLoginAuth(charId, ip.substring(ip.indexOf('/') + 1, ip.length()), c.getTempIP(), c.getChannel(), c.getMac());
/* 49 */     c.updateLoginState(1, ip);
/* 50 */     c.announce(MaplePacketCreator.getServerIP(c, ChannelServer.getInstance(c.getChannel()).getPort(), charId));
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\handling\login\handler\CharSelectedHandler.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */